package com.cloudsigns.factorymanager2.engineering.adapter;

import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.cloudsigns.factorymanager2.R;
import com.cloudsigns.factorymanager2.engineering.bean.EngineeringConstructContentBean;

import com.cloudsigns.factorymanager2.project.myinerface.ItemRemoveListener;

import java.util.ArrayList;
import java.util.List;

/**
 * 编辑施工内容
 * Created by tony on 2018/1/29.
 */

public class EditConstructContentMoreAdapter extends BaseAdapter {
    private Context context;
    private List<EngineeringConstructContentBean> datas = new ArrayList<EngineeringConstructContentBean>();
    private LayoutInflater inflater;
    private String tag = "";


    public EditConstructContentMoreAdapter(Context context, String tag) {
        this.context = context;
        this.inflater = LayoutInflater.from(context);
        this.tag = tag;
    }

    public void setData(List<EngineeringConstructContentBean> list) {
        this.datas.clear();
        if (null != list) {
            this.datas.addAll(list);
        }

    }


    @Override
    public int getCount() {
        return datas.size();
    }

    @Override
    public EngineeringConstructContentBean getItem(int position) {
        return datas.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup viewGroup) {
        final ViewHolder holder;
        if (convertView == null) {
            holder = new ViewHolder();

            convertView = inflater.inflate(R.layout.item_edit_construct_content_more, null);
            holder.tv_content = convertView.findViewById(R.id.tv_content);
            holder.cb_content=convertView.findViewById(R.id.cb_content);

            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        EngineeringConstructContentBean bean = datas.get(position);

        return convertView;
    }

    private class ViewHolder {
        private TextView tv_content;
        private CheckBox cb_content;
    }

}
